#include "stdafx.h"
#include "CConnectSocket.h"
#include "Resource.h"


CConnectSocket::CConnectSocket()
{
}


CConnectSocket::~CConnectSocket()
{
}


void CConnectSocket::OnConnect(int nErrorCode)
{
	/*char s[2048];
	int nLen = Receive(s, sizeof(s) - 1);

	if (nLen <= 0)
		return;

	s[nLen] = 0;
	CWnd *pWnd = AfxGetMainWnd();
	CEdit *pEdit = (CEdit*)pWnd->GetDlgItem(IDC_HIST);

	pEdit->SetSel(-1, -1);
	pEdit->ReplaceSel((LPCTSTR)s);
*/


	CSocket::OnConnect(nErrorCode);
}


void CConnectSocket::OnReceive(int nErrorCode)
{
	char s[2048];
	int nLen = Receive(s, sizeof(s) - 1);

	if (nLen <= 0)
		return;

	s[nLen] = 0;
	CWnd *pWnd = AfxGetMainWnd();
	CEdit *pEdit = (CEdit*)pWnd->GetDlgItem(IDC_HIST);

	pEdit->SetSel(-1, -1);
	pEdit->ReplaceSel((LPCTSTR)s);

	CSocket::OnReceive(nErrorCode);
}
